<?php

namespace App\Listeners;

use App\Events\VipPurchaseBalancePaidEvent;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use App\Services\BuyVip\BuyVip;

class VipPurchaseBalancePaidListener
{
    public function handle(VipPurchaseBalancePaidEvent $event)
    {
        if ($purchase = $event->vipPurchase) {
             app(BuyVip::class, [
                'user' => $purchase->user,
                'vip_category_id' => $purchase->vip_category_id,
                'vip_purchase_id' => $purchase->id
            ])->bought();
        }
    }
}
